import axios from "../../http/axios.js";
import {
  getUserServiceAddress
} from "../../assets/js/serviceAddress.js";

Page({
  data: {
    noList: {
      img: "/assets/img/nojjlxr.png",
      text: "您还没有可用服务地址~"
    },
    list: [
      // {
      //   name: "浙江省杭州市滨江区",
      //   sex: "钱江春晓10号楼508室"
      // },
      // {
      //   name: "浙江省杭州市滨江区",
      //   sex: "钱江春晓10号楼508室"
      // }
    ]
  },
  onLoad: function(options) {},
  onReady: function() {},
  onShow: function() {
    this.getList();
  },
  //获取职工服务地址
  getList: function() {
    getUserServiceAddress().then(list => {
      // console.log("获取服务地址res:", res)
     
      this.setData({
        list
      })
    })
  },
  //编辑服务地址
  editContacts: function(e) {
    wx.navigateTo({
      url: `/pages/u_updateServiceAddress/u_updateServiceAddress?type=edit&item=${JSON.stringify(e.detail)}`,
    })
  },
  //添加服务地址
  addContacts: function() {
    wx.navigateTo({
      url: "/pages/u_updateServiceAddress/u_updateServiceAddress?type=add",
    })
  }
})